﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using ThoiTrang.Entities;
using ThoiTrang.Business;
using System.Collections.Generic;

public partial class UserControls_ucRecruitment : System.Web.UI.UserControl
{
    protected override void OnInit(EventArgs e)
    {
        rptRecruitement.ItemDataBound += new RepeaterItemEventHandler(rptRecruitement_ItemDataBound);
        base.OnInit(e);
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        LoadRecruitement();
    }

    protected void rptRecruitement_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            a_Article art = e.Item.DataItem as a_Article;
            HtmlAnchor lnkRecruite = e.Item.FindControl("lnkRecruite") as HtmlAnchor;
            lnkRecruite.HRef = ResolveUrl(String.Format("~/detail.aspx?{0}={1}&{2}={3}", FOConstants.QSP_AID, art.ID, FOConstants.QSP_CKID, SessionManager.GetCookie()));
            HtmlGenericControl title = e.Item.FindControl("Title") as HtmlGenericControl;
            title.InnerHtml = art.UTitle;
        }
    }

    protected void LoadRecruitement()
    {
        try
        {
            List<a_Article> arts = a_ArticleService.GetRecruitmentArticles();
            rptRecruitement.DataSource = arts;
            rptRecruitement.DataBind();
        }
        catch (Exception ex)
        {
        }
    }
}
